package com.quintilis31.home.common.validation.factory;

import com.quintilis31.home.common.validation.IValidator;
import com.quintilis31.home.common.validation.ValidatorType;
import com.quintilis31.home.common.validation.validators.EmailValidator;
import com.quintilis31.home.common.validation.validators.FirstNameValidator;
import com.quintilis31.home.common.validation.validators.LastNameValidator;

public final class ValidatorFactory {
	
	public static IValidator getValidator(final ValidatorType validatorType) {
		
		IValidator instance = null;
		
		switch (validatorType) {
			case FIRSTNAME : instance = ValidatorFactory.getFirstNameValidator(); break;
			case LASTNAME  : instance = ValidatorFactory.getLastNameValidator(); break;
			case EMAIL     : instance = ValidatorFactory.getEmailValidator(); break;			
		}
		return instance;		
	}
	
	private static IValidator getFirstNameValidator() {
		return FirstNameValidator.getInstance();
	}

	private static IValidator getLastNameValidator() {
		return LastNameValidator.getInstance();
	}
	
	private static IValidator getEmailValidator() {
		return EmailValidator.getInstance();
	}	

}
